package com.agentworkflow.engine.core.enums;

import lombok.Getter;

@Getter
public enum TriggerConfigType {

    MANUAL("manual", "手动触发"),
    API("api", "api触发"),
    SCHEDULE("schedule", "定时触发"),
    WEBHOOK("webhook", "钩子触发");
    private final String code;

    private final String description;

    TriggerConfigType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public TriggerConfigType fromCode(String code) {
        for (TriggerConfigType triggerConfigType : TriggerConfigType.values()) {
            if (triggerConfigType.code.equals(code)) {
                return triggerConfigType;
            }
        }
        return null;
    }
}
